package com.lzwork.gpt.db.entity;

import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.lzwork.utility.collection.MapReader;
import com.lzwork.web.db.SqlEntity;

import lombok.Getter;
import lombok.Setter;

/**
 * @author LiZheng
 * @date 2023年12月4日 下午2:23:05
 */

@Getter
@Setter
public class ApiLogEntity extends SqlEntity
{
	private static final long serialVersionUID = 1L;

	int api;
	int model;
	String url;
	String prompt;
	String param;
	String input;
	String response;
	String cost;
	String time;

	public JSONObject toJObj()
	{
		JSONObject result = new JSONObject();

		result = (JSONObject) JSON.toJSON(this);

		return result;
	}

	public static ApiLogEntity loadFromMap(Map<?, ?> map)
	{
		ApiLogEntity result = MapReader.deserialize(map, ApiLogEntity.class, true, EntityParse.parseSetting());
		return result;
	}
}
